package cn.tedu.review;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author ：Dsi
 * @date ：2021/11/18 9:19
 * Describe ：该类用于回顾泛型
 */
public class TestGeneric {
    public static void main(String[] args) {
        Collection c=new ArrayList();
        c.add("张三");
        c.add(3);
        c.add('男');
        c.add(1000.99);
        System.out.println(c);
        Collection<Integer> c2=new ArrayList<>();
        c2.add(100);
        c2.add(200);
        c2.add(300);
        c2.add(400);
        System.out.println(c2);

        Integer[] a = {1, 2, 3, 4, 5};
        Double[] b = {1.1, 1.2, 1.3, 1.4};
        Character[] c1={'h','a','a','l'};
        plant(a);
        plant(b);
        plant(c1);
    }
    public static <E> void plant(E[] b){
        for (Object a:b
             ) {
            System.out.println(a);
        }
    }
}
